//
// Callout.h
// Usage: Clock interrupt used, Timeout action
// CreateDate: 2009-04-20
// Author: CaiRuicheng MaJiuyue
//
#ifndef _CALLOUT_H_
#define _CALLOUT_H_

#include <type.h>
#include <list.h>

class Callout : public list_head<Callout>
{
private:
	friend class ClockIRQAction;
	u32 m_delay;
	u32 m_remain;

public:
	Callout(u32 delay) { m_delay = delay; }
	virtual ~Callout() {}

	bool operator<(Callout * target)
	{ return this->m_delay < target->m_delay; }

	virtual void operator() () = 0;
};


void timeout(Callout * callout);
void untimeout(Callout * callout);

#endif

